package com.yue.modbus.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.yue.modbus.domain.Device;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Slf4j
public class ExcelListener extends AnalysisEventListener<Device> {

    private List<Device> list = new ArrayList<>();

    @Override
    public void invoke(Device data, AnalysisContext context) {
        list.add(data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
        log.info("excel读取完成");
    }
    public List<Device> getData() {
        return list;
    }
}
